package com.amigo.online.provider.manager.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.amigo.online.common.base.controller.BaseController;
import com.amigo.online.common.core.response.Response;
import com.amigo.online.provider.manager.model.entity.SuggestionTbl;
import com.amigo.online.provider.manager.service.SuggestionTblService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

@RestController
@RequestMapping(value = "/suggestionTbl", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class SuggestionTblController extends BaseController {

    @Resource
    SuggestionTblService suggestionTblService;

    @PostMapping(value = "/getSuggestionTblList")
    public ResponseEntity<Response> getSuggestionTblList(@RequestBody SuggestionTbl suggestionTbl) {
        JSONObject result = new JSONObject();
        // 分页语句
        Page<Object> page = PageHelper.startPage(suggestionTbl.getPageNo(), 10);
        List<SuggestionTbl> suggestionTblList = suggestionTblService.findSuggestionList(suggestionTbl);
        result.put("suggestionTblList", suggestionTblList);
        result.put("pagetotal", page.getTotal());
        return success(result);
    }


}
